#ifndef __GLOBAL_H__
#define __GLOBAL_H__

#include "sys.h"

#include "queue.h"
#include "conf.h"
#include "conn.h"
#include "msg.h"


typedef  void (*SCB)(msg_t* msg);

typedef  struct _ctx{

    conf_t conf;

    tpool_t tp;

    conn_tab_t conn_tab;
    
    int server_id;	
    struct sockaddr_in server_addr; 

   //  int server_port;
	 
     int listenfd;			 // listen socked fd
     pthread_t listen_pid;          // listen thread pid
     pthread_t reconn_pid;
     int epfd;                              //epoll fd

     queue_t recv_msg_q;           //recevied msg queue
     SCB send_callback_fun;	

     queue_t reconn_q;   //reconnect q	 

}ctx_t;


extern ctx_t  g_ctx;


#endif

